package com.myjunjie.blog.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.myjunjie.blog.entity.Article;
import com.myjunjie.blog.service.IArticleService;
import com.myjunjie.blog.service.impl.ArticleServiceImpl;

public class DeleArticleByIdServlet extends HttpServlet{
	private static final long serialVersionUID = 1L;

	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		//获取参数
		response.setContentType("text/html");
		String id = request.getParameter("id");// 获取文章id

		//创建对象
		Article article = new Article();
		article.setId(id);
		
		//调用服务
		IArticleService articleService = new ArticleServiceImpl();
		boolean isSuccess = articleService.deleArticleById(article);
		
		//返回结果
		PrintWriter out = response.getWriter();
		out.println(isSuccess);
	}
}
